package me.goldze.mvvmhabit.binding.viewadapter.radiobutton

import android.widget.RadioButton
import androidx.databinding.BindingAdapter
import me.goldze.mvvmhabit.binding.command.BindingCommand

/**
 * Created by goldze on 2017/6/16.
 */

object ViewAdapter {
    /**
     * @param bindingCommand //绑定监听
     */
    @JvmStatic
    @BindingAdapter(value = ["onCheckedChangedCommand"], requireAll = false)
    fun setCheckedChanged(radioButton: RadioButton, bindingCommand: BindingCommand<Boolean>) {
        radioButton.setOnCheckedChangeListener { _, b ->
            bindingCommand.execute(b)
        }
    }
}